﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Entity;
using Utils;
using Library;
using DataContext;

namespace PaymentBLL
{
    public class CtrItem
    {
        #region ItemIn
        public List<uspItemInSelectByResult> SelectItemInBy(int paymentGateWayId, int status, int currentPage, int pageSize, ref int? totalRecord)
        {
            return DB.PaymentInstance.uspItemInSelectBy(paymentGateWayId, status, currentPage, pageSize, ref totalRecord).ToList();
        }

        public uspItemInSelectResult SelectItemIn(int id)
        {
            return DB.PaymentInstance.uspItemInSelect(id).FirstOrDefault();
        }

        public int ItemInInsert(int paymentGatewayId, string name, string description, int amountIn, int vndIn, int receiveAu,
                                                      int receiveAg, int quantity, int status)
        {
            return DB.PaymentInstance.uspItemInInsert(paymentGatewayId, name, description, amountIn, vndIn, receiveAu,
                                                      receiveAg, quantity, status);
        }

        public int ItemInUpdate(int id, int paymentGatewayId, string name, string description, int amountIn, int vndIn, int receiveAu,
                                                      int receiveAg, int quantity, int status)
        {
            return DB.PaymentInstance.uspItemInUpdate(id, paymentGatewayId, name, description, amountIn, vndIn, receiveAu,
                                                      receiveAg, quantity, status);
        }
        public int ItemInUpdateStatus(int id, int status)
        {
            return DB.PaymentInstance.uspItemInUpdateStatus(id, status);
        }
        public int ItemInDelete(int id)
        {
            return DB.PaymentInstance.uspItemInDelete(id);
        }
        #endregion

        #region ItemOut
        public List<uspItemOutSelectByResult> SelectItemOutBy(int paymentGateWayId, int status, int currentPage, int pageSize, ref int? totalRecord)
        {
            return DB.PaymentInstance.uspItemOutSelectBy(paymentGateWayId, status, currentPage, pageSize, ref totalRecord).ToList();
        }

        public uspItemOutSelectResult SelectItemOut(int id)
        {
            return DB.PaymentInstance.uspItemOutSelect(id).FirstOrDefault();
        }

        public int ItemOutInsert(int paymentGatewayId, string name, string description, int auOut, int agOut,
            int receiveAmount, int vndOut, int quantity, int status)
        {
            return DB.PaymentInstance.uspItemOutInsert(paymentGatewayId, name, description, auOut, agOut,
                receiveAmount, vndOut, quantity, status);
        }
        
        public int ItemOutUpdate(int id, int paymentGatewayId, string name, string description, int auOut, int agOut,
            int receiveAmount, int vndOut, int quantity, int status)
        {
            return DB.PaymentInstance.uspItemOutUpdate(id, paymentGatewayId, name, description, auOut, agOut,
                receiveAmount, vndOut, quantity, status);
        }
        
        public int ItemOutUpdateStatus(int id, int status)
        {
            return DB.PaymentInstance.uspItemOutUpdateStatus(id, status);
        }
        
        public int ItemOutDelete(int id)
        {
            return DB.PaymentInstance.uspItemOutDelete(id);
        }
        #endregion
    }
}
